Docker : Install
2016/06/30 |
Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.
|
|
[1] | Install Docker. |
[root@dlp ~]#
[root@dlp ~]# dnf -y install docker
systemctl start docker [root@dlp ~]# systemctl enable docker |
[2] | Download the official image and create a Container and output the words "Welcome to the Docker World" inside the Container. |
# download the image [root@dlp ~]# docker pull fedora Using default tag: latest Trying to pull repository docker.io/library/fedora ... latest: Pulling from docker.io/library/fedora ... ... # run echo inside Container [root@dlp ~]# docker run fedora /bin/echo "Welcome to the Docker World" Welcome to the Docker World |
[3] | Connect to the interactive session of a Container with "i" and "t" option like follows. If exit from the Container session, the process of a Container finishes. |
[root@dlp ~]#
[root@7eccd2ca69da /]# docker run -i -t fedora /bin/bash [root@7eccd2ca69da /]# # connected
uname -a Linux 7eccd2ca69da 4.5.5-300.fc24.x86_64 #1 SMP Thu May 19 13:05:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux [root@7eccd2ca69da /]# exit exit [root@dlp ~]# # come back
|
[4] | If exit from the Container session with keeping container's process, push Ctrl+p, and Ctrl+q key. |
[root@dlp ~]#
[root@dlp ~]# docker run -i -t fedora /bin/bash [root@139add7a4739 /]# [root@dlp ~]# # Ctrl+p, Ctrl+q key
docker ps # show docker process CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 139add7a4739 fedora "/bin/bash" 21 seconds ago Up 19 seconds sharp_poincare # connect to container's session [root@dlp ~]# docker attach 139add7a4739 [root@139add7a4739 /]# # connected
# shutdown container's process from Host's console [root@dlp ~]# docker kill 139add7a4739 [root@dlp ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |